package org.file_service.controller;

import org.file_service.entity.User;
import org.file_service.lang.Result;
import org.file_service.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    public UserService userService;

    @ResponseBody
    @RequestMapping("/login")
    public Result login(@RequestBody User user){
        return userService.login(user.getName(), user.getPassword());
    }

    @ResponseBody
    @RequestMapping("/enroll")
    public Result enroll(@RequestBody User user){
        return userService.enroll(user.getName(), user.getPassword());
    }
}
